package com.aspose.cells.a.d;

import java.util.ArrayList;
import java.util.Iterator;

public class zcz {
   public static void a(zcu var0, boolean var1) throws Exception {
      a(var0, var0.c(), "", var1);
      ArrayList var2 = new ArrayList();
      Iterator var3 = var0.b().iterator();

      zcv var4;
      while(var3.hasNext()) {
         var4 = (zcv)var3.next();
         if (var4.e().a() > 0) {
            com.aspose.cells.b.a.a.ze.a(var2, (Object)var4);
         }
      }

      var3 = var2.iterator();

      while(var3.hasNext()) {
         var4 = (zcv)var3.next();
         a(var0, var4.e(), var4.a(), var1);
      }

   }

   private static void a(zcu var0, zcy var1, String var2, boolean var3) throws Exception {
      int var4 = var2.lastIndexOf(47);
      String var5 = var2.substring(0, 0 + var4 + 1);
      String var6 = var2.substring(var4 + 1);
      String var7 = com.aspose.cells.b.a.zv.a("{0}{1}_rels/{2}.rels", var5.startsWith("/") ? "" : "/", var5, var6);
      zcv var8 = new zcv(var7, "application/vnd.openxmlformats-package.relationships+xml");
      com.aspose.cells.zal var9 = new com.aspose.cells.zal(var8.d(), var3);
      var9.a("Relationships");
      var9.c("xmlns", "http://schemas.openxmlformats.org/package/2006/relationships");

      for(Iterator var10 = var1.iterator(); var10.hasNext(); var9.c()) {
         zcx var11 = (zcx)var10.next();
         var9.b("Relationship");
         var9.c("Id", var11.a());
         var9.c("Type", var11.b());
         var9.c("Target", var11.c());
         if (var11.d()) {
            var9.c("TargetMode", "External");
         }
      }

      var9.b();
      var0.b().a(var8);
   }
}
